<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/vue-2.4.0.js"></script>
    <style>
        li{
            border: 1px solid #999;
            margin: 5px;
            width: 100%;
            line-height: 34px;
            padding-left: 5px;
        }
        li:hover{
            background-color: hotpink;
            /*transition: all .8s;*/
        }

        .v-enter,.v-leave-to{
            opacity: 0;
            transform: translateX(80px);
        }
        .v-enter-active,.v-leave-active{
            transition: all 1s;
        }

        .v-move{
            transition: all 0.6s ease;
        }
        .v-leave-active{
            position: absolute;
        }
    </style>
</head>
<body>
<div id="app">
    <div>
        <label for="">
            ID: <input type="text" v-model="id">
        </label>
        <label for="">
            NAME: <input type="text" v-model="name">
        </label>
        <input type="button" value="添加" @click="add">
    </div>
<!--    <ul>-->
        <transition-group appear tag="ul">
            <li @click="del(i)" v-for="(item,i) in list" :key="item.id">
                {{item.id}}-----{{item.name}}
            </li>
        </transition-group>
<!--    </ul>-->
</div>
<script>
    var vm=new Vue({
        el:'#app',
        data:{
            id:'',
            name:'',
            list:[
                {id:1,name:'赵高'},
                {'id':2,'name':'秦桧'},
                {'id':3,'name':'严嵩'},
                {'id':4,'name':'魏忠贤'}
            ]
        },
        methods:{
            add(){
                this.list.push({id:this.id,name:this.name})
            },
            del(i){
                this.list.splice(i, 1)
            }
        }
    })
</script>
</body>
</html>